# Maintainer: Felix Yan <felixonmars@archlinux.org>
# Contributor: Josip Ponjavic <josipponjavic at gmail dot com>
# Contributor: Xu Fasheng <fasheng.xu[AT]gmail.com>

pkgname=deepin-terminal
pkgver=6.0.8
pkgrel=1
pkgdesc='Default terminal emulation application for Deepin'
arch=('loong64' 'x86_64')
url="https://github.com/linuxdeepin/deepin-terminal"
license=('GPL3')
depends=('dtkcore' 'dtkgui' 'dtkwidget' 'glib2' 'qt5-base' 'qt5-x11extras' 'libsecret' 'glibc'
         'gcc-libs' 'libxcb' 'fontconfig' 'hicolor-icon-theme')
makedepends=('cmake' 'lxqt-build-tools' 'ninja' 'qt5-tools')
#checkdepends=('xorg-server-xvfb')
optdepends=('zssh: for remote management support')
groups=('deepin-extra')
source=("https://github.com/linuxdeepin/deepin-terminal/archive/$pkgver/$pkgname-$pkgver.tar.gz"
        $pkgname-break-non-dde.patch::https://github.com/linuxdeepin/deepin-terminal/commit/0df1446c1af214ffb568e7b956edbed7e656abf3.patch)
sha512sums=('7724ef53c877d897addefc7afd228a7bf67eb935de0343d6ce9ad021922f11dc2134bb5f66f7b3fefa5d247cd337b7b53573d69df576dc4dc8d5e6b9e68f5200'
            'b2a6df7aa55ca5a89c117fd784dd5ef2860a3f8410bbee8c224e4e4b98fe044a3248422f93c08a6605d5e4c091022db01e84a56637fcade8e0fd2a2962629b13')

prepare() {
  cd deepin-terminal-$pkgver
  # https://github.com/linuxdeepin/developer-center/issues/5723
  patch -Rp1 -i ../$pkgname-break-non-dde.patch
}

build(){
  cd deepin-terminal-$pkgver
  cmake . -GNinja -DVERSION=$pkgver -DCMAKE_INSTALL_PREFIX=/usr
  ninja
}

check() {
  cd deepin-terminal-$pkgver
  #LD_LIBRARY_PATH="$PWD/3rdparty/terminalwidget" xvfb-run ninja test || echo "Tests failed"
}

package() {
  cd deepin-terminal-$pkgver
  DESTDIR="$pkgdir" ninja install
}
